<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>{echo: lp{m_u_center};/}</title>
<link rel="stylesheet" type="text/css" href="skin/{echo: $SYSINFO['templates'];/}/css/modules.css">
<link rel="stylesheet" type="text/css" href="skin/{echo: $SYSINFO['templates'];/}/css/layout.css">
<script type="text/javascript" src="skin/{echo: $SYSINFO['templates'];/}/js/changeStyle.js"></script>
<link rel="stylesheet" type="text/css" href="skin/{echo: $SYSINFO['templates'];/}/css/style.css">
<script type="text/javascript" src="skin/{echo: $SYSINFO['templates'];/}/js/userchangeStyle.js"></script>
<style type="text/css">
th{background:#EFEFEF}
td span{color:red;}
</style>
</head>
<body onload="menu_style_change('user_my_order');changeMenu();">
{inc: require("shop/index_header.php");/}

	<div class="site_map">
	  {echo:lp{m_current_position};/}<A href="index.php">{echo:$SYSINFO['sys_name'];/}</A>/<a href="modules.php">{echo:lp{m_u_center};/}</a>/&nbsp;&nbsp;{echo: lp{m_my_group_buy_orders};/}
	</div>
    <div class="clear"></div>
    {inc: require("modules/left_menu.php");/}
    <div class="main_right">
		<div class="right_top"></div>
		<div class="cont">
			<div class="cont_title">
				{echo: lp{m_my_group_buy_orders};/}
			</div>
			<hr />
			 <div id="stepTip" class="clearfix">
     <ul class="list_step1 clearfix">
     <li>{echo: lp{m_u_first};/}:<br />{echo: lp{m_ordernow_add};/}</li>
     <li class="now">{echo: lp{m_u_secound};/}:<br />{echo: lp{m_sure_ordernow};/}</li>
     <li style="padding-right:0">{echo: lp{m_u_third};/}:<br />{echo: lp{m_accomplish};/}</li>
     </ul>
     </div>
			<form action="do.php?act=user_order" method="post" name="for{echo: lp{m_profile};/}" onsubmit="return checkform();">
				<table  width="100%" border="0" cellspacing="0">
					<tr>
						<th>{echo: lp{m_group_name};/}</th>
						<th>{echo: lp{m_group_price};/}</th>
						<th>{echo: lp{m_buy_num};/}</th>
						<th>{echo: lp{m_transport_price};/}</th>
					</tr>
					<tr>
						<td align="center">{echo: $goods_info['group_name'];/}</td>
						<td align="center">{echo: $goods_info['spec_price'];/}{echo: lp{m_yuan};/}</td>
						<td align="center">{echo: $goods_info['quantity'];/}</td>
						<td align="center">{echo: $goods_info['transport_price'];/}{echo: lp{m_yuan};/}</td>
					</tr>
					<input type="hidden" value="{echo: $goods_info['shop_id'];/}" name="sshop_id" />
					<input type="hidden" value="{echo: $goods_info['goods_id'];/}" name="goods_id" />
					<input type="hidden" value="{echo: $goods_info['goods_name'];/}" name="goods_name" />
					<input type="hidden" value="{echo: $goods_info['group_id'];/}" name="group_id" />
					<input type="hidden" value="{echo: $goods_info['grouplog_id'];/}" name="grouplog_id" />
					<input type="hidden" value="{echo: $goods_info['spec_price'];/}" name="goods_price" />
					<input type="hidden" value="{echo: $goods_info['transport_price'];/}" name="transport_price" />
					<input type="hidden" value="{echo: $goods_info['quantity'];/}" name="quantity" />
					<input type="hidden" value="{echo: $goods_info['spec_price'] * $goods_info['quantity'] + $goods_info['quantity'] * $goods_info['transport_price'];/}" name="order_amount" />
					<tr><td colspan="4">{echo: lp{m_order_thisbuyprice};/}:<span>{echo: $goods_info['spec_price'] * $goods_info['quantity'] + $goods_info['quantity'] * $goods_info['transport_price'];/}</span>{echo: lp{m_yuan};/}</td></tr>
				</table>
							  <table  width="100%" border="0" cellspacing="0">
					<tr>
						<th colspan="2">&nbsp;&nbsp;{echo: lp{m_order_getsting};/}</th>
					</tr>
					<tr><td class="textright" align="left">{echo: lp{m_contact};/}:</td>
						<td>{echo: $user_info['to_user_name'];/}</td></tr>
					<tr>
						<td class="textright">{echo: lp{m_stayarea};/}:</td>
						<td>
							
							{sta: foreach($areas_info[0] as $v)[loop]}
									{sta: if($v['area_id']==$user_info['user_country'])[exc]}{echo: $v['area_name'];/}{end:if/}
							{end:foreach/}
							&nbsp;
							{sta:if($user_info['user_country']) [exc]}
							
							{sta: foreach($areas_info[1] as $v) {
									if($v['parent_id'] == $user_info['user_country']) [exc]}
								
								{sta: if($v['area_id']==$user_info['user_province'])[exc]}{echo: $v['area_name'];/}{end:if/}
							{end:if/}
							{end:foreach/}
							{end:if/}&nbsp;
							{sta: if($user_info['user_province']) [exc]}
						
							{sta: foreach($areas_info[2] as $v) {
									if($v['parent_id'] == $user_info['user_province'])[exc]}
							
								{sta: if($v['area_id']==$user_info['user_city'])[exc]}{echo: $v['area_name'];/}{end:if/}
							{end:if/}
							{end:foreach/}
							{end:if/}&nbsp;
							{sta:  if($user_info['user_city']) [exc]}
							
								
							{sta: foreach($areas_info[3] as $v) {
									if($v['parent_id'] == $user_info['user_city']) [exc]}
								
								{sta: if($v['area_id']==$user_info['user_district'])[exc]}{echo: $v['area_name'];/}{end:if/}
							{end:if/}
							{end:foreach/}
							{end:if/}
						</td>
					</tr>
					<tr><td class="textright">{echo: lp{m_address};/}:</td>
					<td>{echo: $user_info['full_address'];/}</td></tr>
					<tr><td class="textright">{echo: lp{m_zipcode};/}:</td>
					<td>{echo: $user_info['zipcode'];/}</td></tr>
					<tr><td class="textright">{echo: lp{m_mobile};/}:</td>
						<td>{echo: $user_info['mobile'];/}</td></tr>
					<tr><td class="textright">{echo: lp{m_telphone};/}:</td>
						<td>{echo: $user_info['telphone'];/}</td></tr>
					<tr><td class="textright">{echo: lp{m_email};/}:</td>
						<td>{echo:$user_info['email'];/}</td></tr>
					<tr><td colspan="2">&nbsp;&nbsp;<span>{echo: lp{m_sureaddress_rcgoods};/}</span></td></tr>
				</table>
				<table  width="100%" border="0" cellspacing="0" style="display:none">
					<tr>
						<th colspan="2">&nbsp;&nbsp;{echo: lp{m_order_getsting};/}</th>
					</tr>
					<tr><td class="textright" align="left">{echo: lp{m_contact};/}:</td>
						<td><input type="text" name="to_user_name" value="{echo: $goods_info['linkman'];/}" maxlength="12" /></td></tr>
					<tr>
						<td class="textright">{echo: lp{m_stayarea};/}:</td>
						<td>
							<span id="user_country"><select name="country" onchange="areachanged(this.value,0);">
								<option value='0'>{echo: lp{m_select_country};/}</option>
							{sta: foreach($areas_info[0] as $v)[loop]}
								<option value="{echo: $v['area_id'];/}"
									{sta: if($v['area_id']==$user_info['user_country']){echo 'selected';if/}>{echo: $v['area_name'];/}</option>
							{end:foreach/}
							</select></span>
							<span id="user_province">{sta:if($user_info['user_country']) [exc]}
							<select name="province" onchange="areachanged(this.value,1);">
								<option value='0'>{echo: lp{m_select_province};/}</option>
							{sta: foreach($areas_info[1] as $v) {
									if($v['parent_id'] == $user_info['user_country']) [exc]}
								<option value="{echo: $v['area_id'];/}"
								{sta: if($v['area_id']==$user_info['user_province']){echo 'selected';if/}>{echo: $v['area_name'];/}</option>
							{end:if/}
							{end:foreach/}
							</select>
							{end:if/}</span>
							<span id="user_city">{sta: if($user_info['user_province']) [exc]}
							<select name="city" onchange="areachanged(this.value,2);">
								<option value='0'>{echo: lp{m_select_city};/}</option>
							{sta: foreach($areas_info[2] as $v) {
									if($v['parent_id'] == $user_info['user_province'])[exc]}
								<option value="{echo: $v['area_id'];/}"
								{sta: if($v['area_id']==$user_info['user_city']){echo 'selected';if/}>{echo: $v['area_name'];/}</option>
							{end:if/}
							{end:foreach/}</select>
							{end:if/}</span>
							<span id="user_district">{sta:  if($user_info['user_city']) [exc]}
							<select name="district">
								<option value='0'>{echo: lp{m_select_district};/}</option>
							{sta: foreach($areas_info[3] as $v) {
									if($v['parent_id'] == $user_info['user_city']) [exc]}
								<option value="{echo: $v['area_id'];/}"
								{sta: if($v['area_id']==$user_info['user_district']){echo 'selected';if/}>{echo: $v['area_name'];/}</option>
							{end:if/}
							{end:foreach/}</select>
							{end:if/}</span>
						</td>
					</tr>
					<tr><td class="textright">{echo: lp{m_address};/}:</td>
					<td><input type="text" name="full_address" value="{echo: $user_info['full_address'];/}" style="width:250px;" maxlength="200" /></td></tr>
					<tr><td class="textright">{echo: lp{m_zipcode};/}:</td>
					<td><input type="text" name="zipcode" value="{echo: $user_info['zipcode'];/}" maxlength="6" /></td></tr>
					<tr><td class="textright">{echo: lp{m_mobile};/}:</td>
						<td><input type="text" name="mobile" value="{echo: $user_info['mobile'];/}" maxlength="20" /></td></tr>
					<tr><td class="textright">{echo: lp{m_telphone};/}:</td>
						<td><input type="text" name="telphone" value="{echo: $user_info['telphone'];/}" maxlength="20" /></td></tr>
					<tr><td class="textright">{echo: lp{m_email};/}:</td>
						<td><input type="text" name="email" value="{echo:$user_info['email'];/}" maxlength="20" /></td></tr>
					<tr><td colspan="2">&nbsp;&nbsp;<span>{echo: lp{m_sureaddress_rcgoods};/}</span></td></tr>
				</table>
				<table  width="100%" border="0" cellspacing="0">
					<tr>
						<th colspan="2">&nbsp;&nbsp;{echo: lp{m_sure_postorder};/}</th>
					</tr>
					<tr><td class="textright">{echo: lp{m_order_message};/}:</td><td><textarea name="message" style="width:280px;height:60px"></textarea></td></tr>
					<tr><td colspan="2" align="center">
					<input type="hidden" name="user_id" value="{echo: $user_info['user_id'];/}" />
					<input type="hidden" name="pay_id" value="{echo: $payment_info['pay_id'];/}" />
					<input type="hidden" name="pay_name" value="{echo: $payment[$payment_info['pay_id']]['pay_name'];/}" />
					<input type="submit" class="submit" name="submit" value="{echo: lp{m_post_order};/}" /></td></tr>
				</table>
			</form>
        </div>
    </div>
<div class="clear"></div>
{inc: require("shop/index_footer.php");/}
<script language="JavaScript" src="servtools/ajax_client/ajax.js"></script>
<script language="JavaScript">
<!--
function areachanged(value,type){
	if(value > 0) {
		ajax("do.php?act=ajax_areas","POST","value="+value+"&type="+type,function(return_text){
			var return_text = return_text.replace(/[\n\r]/g,"");
			if(return_text==""){
				alert("");
			} else {
				if(type==0) {
					document.getElementById("user_province").innerHTML = return_text;
					show("user_province");
					hide("user_city");
					hide("user_district");
				} else if(type==1) {
					document.getElementById("user_city").innerHTML = return_text;
					show("user_city");
					hide("user_district");
				} else if(type==2) {
					document.getElementById("user_district").innerHTML = return_text;
					show("user_district");
				}
			}
		});
	} else {
		if(type==2) {
			hide("user_district");
		} else if(type==1) {
			hide("user_district");
			hide("user_city");
		} else if(type==0) {
			hide("user_district");
			hide("user_city");
			hide("user_province");
		}
	}
}

function hide(id) {
	document.getElementById(id).style.display = 'none';
}

function show(id) {
	document.getElementById(id).style.display = '';
}


function checkform(){
	var to_user_name = document.getElementsByName('to_user_name')[0];
	if(to_user_name.value==''){
		alert('{echo:lp{m_pl_getgoods_name};/}');
		return false;
	}

	var province = document.getElementsByName('province')[0];
	if(province.value==0){
		alert('{echo:lp{m_pl_getgoods_province};/}');
		return false;
	}

	var city = document.getElementsByName('city')[0];
	if(city.value==0){
		alert('{echo:lp{m_pl_getgoods_city};/}');
		return false;
	}

	var district = document.getElementsByName('district')[0];
	if(district.value==0){
		alert('{echo:lp{m_pl_getgoods_district};/}');
		return false;
	}

	var full_address = document.getElementsByName('full_address')[0];
	if(full_address.value==''){
		alert('{echo:lp{m_pl_getgoods_address};/}');
		return false;
	}

	var zipcode = document.getElementsByName('zipcode')[0];
	if(zipcode.value==''){
		alert('{echo:lp{m_pl_getgoods_zipcode};/}');
		return false;
	}

	var email = document.getElementsByName('email')[0];
	var user_email_reg = /^[0-9a-zA-Z_\-\.]+@[0-9a-zA-Z_\-]+(\.[0-9a-zA-Z_\-]+)*$/;
	if(!email.value=='' && !user_email_reg.test(email.value)){
		alert('{echo:lp{m_email_type_notine};/}');
		return false;
	}

	var user_mobile = document.getElementsByName('mobile')[0];
	var user_mobile_reg = new RegExp("[0-9-]{5,15}");

	var user_telphone = document.getElementsByName('telphone')[0];
	var user_telphone_reg = new RegExp("[0-9-]{5,15}");

	if(user_mobile.value=='' && user_telphone.value=='') {
		alert('{echo:lp{m_sorry_p_mselectone};/}');
		return false;
	} else if(!user_mobile.value=='' && !user_mobile_reg.test(user_mobile.value)) {
		alert('{echo:lp{m_sorry_mobiletype};/}');
		return false;
	} else if(!user_telphone.value=='' && !user_telphone_reg.test(user_telphone.value)) {
		alert('{echo:lp{m_sorry_phonetype};/}');
		return false;
	}else {
		return true;
	}

}

function changeurl(v){
	var re = /&address_id=[0-9]+/g;
	location.href = location.href.replace(re,'')+'&address_id='+v;
}

function clearaddress() {
	areachanged(1,0);
	var to_user_name = document.getElementsByName('to_user_name')[0];
	to_user_name.value="";
	var full_address = document.getElementsByName('full_address')[0];
	full_address.value="";
	var zipcode = document.getElementsByName('zipcode')[0];
	zipcode.value="";
	var mobile = document.getElementsByName('mobile')[0];
	mobile.value="";
	var telphone = document.getElementsByName('telphone')[0];
	telphone.value="";
	var email = document.getElementsByName('email')[0];
	email.value="";
}
//-->
</script>
</body>
</html>